package com.lzx.resumeweb.api;

import com.lzx.resumebase.model.Result;
import com.lzx.resumebase.model.Skill;
import com.lzx.resumebase.util.ResultUtil;
import com.lzx.resumeservice.service.SkillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @ClassName SkillApi
 * @Author 刘正星
 * @Date 2021/6/1 2:31
 **/
@RestController
@RequestMapping("/skill")
public class SkillApi {

    @Autowired
    private SkillService skillService;

    @GetMapping("/getByUserId/{userId}")
    public Result getSkills(@PathVariable("userId") String userId){
        if (!StringUtils.hasText(userId)){
            return ResultUtil.paramError();
        }
        return ResultUtil.success(skillService.lambdaQuery().eq(StringUtils.hasText(userId),Skill::getUserid,userId).list());
    }
}
